package book;

public class InterruptTest {

	static class MyThread extends Thread{
		
		public void run(){
			
			for(int i = 0; i < 500000 * 1000; i++){
				
			}
		}
	}
	
	public static void main(String[] args) throws InterruptedException {
		
		MyThread t = new MyThread();
		t.start();
		t.interrupt();
		Thread.currentThread().interrupt();
		
		//Thread的静态方法，测试当前线程是否被打断，并且调用此方法终端标志被重置为false，所有第二次调用返回的是false
		System.out.println("主线程是否停止：" + Thread.interrupted()); 
		System.out.println("主线程是否停止2：" + Thread.interrupted());
		
		System.out.println("子线程是否停止：" + t.isInterrupted());
	}
}
